import request from "@/utils/request.js";

/**
 * 分页查询应用分类
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const queryAppCategoryPage = (data) => {
  return request.post("/admin/category/page", data);
};

/**
 * 通过id查询应用分类
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const queryAppCategoryById = (data) => {
  return request.get("/admin/category/" + data);
};

/**
 * 新增应用分类
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const saveAppCategory = (data) => {
  return request.post("/admin/category", data);
};

/**
 * 删除应用分类
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const removeAppCategory = (data) => {
  return request.delete("/admin/category", { data });
};

/**
 * 更新应用分类
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const updateAppCategory = (data) => {
  return request.put("/admin/category", data);
};

/**
 * 导出应用分类表格
 */
export const exportAppCategory = (data) => {
  return request.post("/admin/category/export", data, { responseType: "blob" });
};

/**
 * 查询正常应用分类列表
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const queryAppCategoryNormalList = () => {
  return request.get("/admin/category/list")
}
